package com.example.pictureeffect;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {

	private MyView myView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		myView = (MyView)findViewById(R.id.myView);
		Button btn = (Button)findViewById(R.id.Grayscale);
		Button btn1 = (Button)findViewById(R.id.Sepia);
		Button btn2 = (Button)findViewById(R.id.Contrast);
		Button btn3 = (Button)findViewById(R.id.Alpha);
		
		btn.setOnClickListener(this);
		btn1.setOnClickListener(this);
		btn2.setOnClickListener(this);
		btn3.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.Grayscale:
			myView.changeGray();
			break;
			
		case R.id.Sepia:
			myView.changeSepia();
			break;
			
		case R.id.Contrast:
			myView.changeContrast();
			break;
			
		case R.id.Alpha:
			myView.changeAlphaGra();
			break;
		}
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
